<style>
.basetoolbar_main {
  background: url(image/bg.png) repeat;
  height: 135px;
  display: none;
}
.basetoolbar_sub {
  background: url(image/shdw.gif) repeat-x;
  height: 14px;
}
.basetoolbar_toolbar {
  width: 100%;
  height: 90px;
  color: #7d7d7d;
  padding: 0 20px;
}
.basetoolbar_img {
  cursor: pointer;
}
.basetoolbar_control {
  width: 100%;
  margin-bottom: 30px;
}
</style>

<div id="basetoolbar_main" class="basetoolbar_main">
  <table class="basetoolbar_toolbar" cellPadding="0" cellSpacing="0">
    <tr>
      <td style="width: 600px;"></td>
      <td>
        <img src="image/one3.png" class="basetoolbar_img" onclick="location.href='admin.php';"></img>
      </td>
      <td style="text-align: right;">
        <select>
          <option onclick="document.cookie='language=en';location.reload();" {{if $lang=='en'}}selected="selected"{{/if}}>English</option>
          <option onclick="document.cookie='language=zh_CN';location.reload();" {{if $lang=='zh_CN'}}selected="selected"{{/if}}>简体中文</option>
          <option onclick="document.cookie='language=zh_TW';location.reload();" {{if $lang=='zh_TW'}}selected="selected"{{/if}}>繁体中文</option>
        </select>
        | <a href="admin.php?logout=">Sign out</a>
      </td>
    </tr>
  </table>
</div>
<div class="basetoolbar_sub"></div>
<div class="basetoolbar_control">
  <span id="basetoolbar_up" class="image_button" style="width: 22px;margin-left: 800px;border-top: 0;display: none;" onclick="toolbar_up();">
    <table>
      <tr>
        <td><img src="image/btn/up.png"></img></td>
      </tr>
    </table>
  </span>
  <span id="basetoolbar_down" class="image_button" style="width: 22px;margin-left: 800px;border-top: 0;" onclick="toolbar_down();">
    <table>
      <tr>
        <td><img src="image/btn/down.png"></img></td>
      </tr>
    </table>
  </span>
</div>

<script type="text/javascript">
  <!--
    if (document.addEventListener) {
      document.addEventListener('DOMContentLoaded', init, false);
    }
    window.onload = init;
    
    _toolbar = 'toolbar';
  
    function init() {
      if (!document.getElementById || !document.createElement || !arguments || arguments.callee._loaded) {
        return;
      }
      arguments.callee._loaded = true;
      if (getCookie(_toolbar) == 1) {
        document.getElementById('basetoolbar_main').style.display = 'block';
        document.getElementById('basetoolbar_up').style.display = 'block';
        document.getElementById('basetoolbar_down').style.display = 'none';
      };
    }
    
    function toolbar_up() {
      document.getElementById('basetoolbar_main').style.display = 'none';
      document.getElementById('basetoolbar_up').style.display = 'none';
      document.getElementById('basetoolbar_down').style.display = 'block';
      setCookie(_toolbar, 0, 7);
    }
    
    function toolbar_down() {
      document.getElementById('basetoolbar_main').style.display = 'block';
      document.getElementById('basetoolbar_up').style.display = 'block';
      document.getElementById('basetoolbar_down').style.display = 'none';
      setCookie(_toolbar, 1, 7);
    }
    
    function setCookie(c_name, value, exdays) {
      var exdate = new Date();
      exdate.setDate(exdate.getDate() + exdays);
      var c_value = escape(value) + ((exdays==null) ? '' : '; expires=' + exdate.toUTCString());
      document.cookie = c_name + '=' + c_value;
    }
    
    function getCookie(c_name) {
      var i, x, y, ARRcookies = document.cookie.split(';');
      for (i = 0; i < ARRcookies.length; i++) {
        x = ARRcookies[i].substr(0,ARRcookies[i].indexOf('='));
        y = ARRcookies[i].substr(ARRcookies[i].indexOf('=')+1);
        x = x.replace(/^\s+|\s+$/g, '');
        if (x == c_name) {
          return unescape(y);
        }
      }
    }
  // -->
</script>
